<style>
    .item {
        margin-bottom: 15px;
    }

    .item .title {
        color: #333;
    }
</style>

<div class="rightcontent rc-bg-grey">
    <div class="rc-pagepadding">
        <div class=" rc-pannel ">
            <div class=" rc-pannel-header rc-pagepadding rc-bold nobottom">
                系统信息 
            </div>


            <div class="rc-pannel-body layui-form rc-pagepadding">


                <div class="item"> <span class="title">官方网站：</span> <span> <a class="primary" href="https://fc.rovecoder.com" target="_blank">https://fc.rovecoder.com</a></span></div>
                <div class="item"> <span class="title">使用文档：</span> <span> <a class="primary" href="https://docx.rovecoder.com/app_cms_page/9/1" target="_blank">https://docx.rovecoder.com/app_cms_page/9/1</a></span></div>
                <div class="item"> <span class="title">二次开发文档：</span> <span> <a class="primary" href="https://docx.rovecoder.com/app_cms_page/18/10" target="_blank"> https://docx.rovecoder.com/app_cms_page/18/10</a></span></div>
                <div class="item"> <span class="title">操作系统：</span> <span> <?php echo PHP_OS ?></span></div>
                <div class="item"> <span class="title">PHP版本：</span> <span> <?php echo PHP_VERSION ?></span></div>
                <div class="item"> <span class="title">数据库：</span> <span> <?php echo PHP_VERSION ?></span></div>
                <div class="item"> <span class="title">当前版本</span> <span> <b> <?php echo config('frame.version'); ?></b> </span></div>
                <?php
                if (config('frame.nextversion') != '') {
                ?>
                    <div class="item"> <span class="title">有新版本</span>
                        <span> <b> <?php echo config('frame.nextversion'); ?></b>
                            <a class="primary" id="upgrade"><b>在线升级</b></a>
                        </span>
                    </div>
                <?php
                }
                ?>

            </div>
        </div>
    </div>
</div>
<script>
    layui.use(function() {

        var layer = layui.layer;
        var form = layui.form;
        $('.systemadmin').click(function() {
            var siteid = $(this).attr('siteid');
            layer.open({
                type: 2,
                offset: 'r',
                move: false,
                anim: 'slideLeft', // 从右往左
                area: ['600px', '100%'],
                shade: 0.1,
                title: '设置站点超级管理员',
                id: 'ID-demo-layer-direction-r',
                content: '/admin/cnf/Site/systemAdmin?id=' + siteid
            });

        });


        $('#upgrade').click(function() {
            layer.open({
                title: '框架升级',
                type: 1,
                area: ['420px', '280px'], // 宽高
                content: '<div id="upgradecontent" class="rc-pagepadding"></div>',
                btn: ['立即升级', '取消'],

                // 按钮1 的回调
                btn1: function(index, layero, that) {
                    if (!$("#backsystem").is(":checked") ||
                        !$("#backdatabase").is(":checked")) {
                        toastr_error('请确认是否备份了数据库和系统');
                        return;
                    }

                    layer.load(2);
                    $.ajax({
                        url: '/admin/cnf/Frame/upgrade', //请求路径
                        type: "POST", //请求方式
                        success: function(data) {
                            if (data.code == 0) {
                                toastr_success("升级成功", function() {
                                    window.location.reload();
                                });

                            } else {
                                toastr_error(data.message);
                            }
                            layer.closeAll();
                        },
                        error: function() {
                            layer.closeAll();
                        },

                    });
                }

            });


            $('#upgradecontent').append(`
                <div class="layui-timeline layui-form">
                    <div class="layui-timeline-item">
                        <i class="layui-icon layui-timeline-axis layui-icon-circle"></i>
                        <div class="layui-timeline-content layui-text">
                          <h6 class="layui-timeline-title">请先备份系统</h6>
                        </div>
                    </div>

                    <div class="layui-timeline-item">
                        <i class="layui-icon layui-timeline-axis layui-icon-circle"></i>
                        <div class="layui-timeline-content layui-text">
                          <h6 class="layui-timeline-title">请先备份数据库</h6>
                        </div>
                    </div>

                    <div class="layui-timeline-item">
                        <input type="checkbox" name="" id="backsystem" title="系统已备份">
                        <input type="checkbox" name="" id="backdatabase" title="数据已备份">
                    </div>
                </div>
            `);

            form.render();

        });


    });
</script>